package log4j;

import org.apache.log4j.Logger;

/**
 * @author 孙继峰
 * @date 2019/06/04
 */
public class Log4jTest {
    private static final Logger LOGGER = Logger.getLogger(Log4jTest.class);

    /**
     * 级别从低到高 DEBUG -> INFO -> WARN -> ERROR
     * 级别越低, 输出的内容越多
     */
    public static void main(String[] args) {
        LOGGER.debug("debug");
        LOGGER.info("info");
        LOGGER.warn("warn");
        LOGGER.error("error");

        try {
            int a = 10/0;
        } catch (Exception e) {
            LOGGER.error(e, e.getCause());
        }
    }
}
